package o;

import o.eo.a;

public class ev extends eu {
    int ʻ = 0;
    float ʼ;
    private ev ʽ;
    ev ˊ;
    private float ˊॱ;
    ev ˋ;
    private ex ˋॱ = null;
    float ˎ;
    eo ˏ;
    private int ˏॱ = 1;
    private ex ͺ = null;
    float ॱ;
    private int ॱˊ = 1;

    public ev(eo eoVar) {
        this.ˏ = eoVar;
    }

    public String toString() {
        if (this.ᐝ != 1) {
            return "{ " + this.ˏ + " UNRESOLVED} type: " + ˎ(this.ʻ);
        }
        if (this.ˊ == this) {
            return "[" + this.ˏ + ", RESOLVED: " + this.ʼ + "]  type: " + ˎ(this.ʻ);
        }
        return "[" + this.ˏ + ", RESOLVED: " + this.ˊ + ":" + this.ʼ + "] type: " + ˎ(this.ʻ);
    }

    public void ˋ(ev evVar, float f) {
        if (this.ᐝ == 0 || !(this.ˊ == evVar || this.ʼ == f)) {
            this.ˊ = evVar;
            this.ʼ = f;
            if (this.ᐝ == 1) {
                ˊ();
            }
            ʻ();
        }
    }

    String ˎ(int i) {
        if (i == 1) {
            return "DIRECT";
        }
        if (i == 2) {
            return "CENTER";
        }
        if (i == 3) {
            return "MATCH";
        }
        if (i == 4) {
            return "CHAIN";
        }
        if (i == 5) {
            return "BARRIER";
        }
        return "UNCONNECTED";
    }

    public void ˏ() {
        int i = 0;
        if (this.ᐝ != 1 && this.ʻ != 4) {
            if (this.ͺ != null) {
                if (this.ͺ.ᐝ == 1) {
                    this.ˎ = ((float) this.ॱˊ) * this.ͺ.ॱ;
                } else {
                    return;
                }
            }
            if (this.ˋॱ != null) {
                if (this.ˋॱ.ᐝ == 1) {
                    this.ˊॱ = ((float) this.ˏॱ) * this.ˋॱ.ॱ;
                } else {
                    return;
                }
            }
            if (this.ʻ == 1 && (this.ˋ == null || this.ˋ.ᐝ == 1)) {
                if (this.ˋ == null) {
                    this.ˊ = this;
                    this.ʼ = this.ˎ;
                } else {
                    this.ˊ = this.ˋ.ˊ;
                    this.ʼ = this.ˋ.ʼ + this.ˎ;
                }
                ʻ();
            } else if (this.ʻ == 2 && this.ˋ != null && this.ˋ.ᐝ == 1 && this.ʽ != null && this.ʽ.ˋ != null && this.ʽ.ˋ.ᐝ == 1) {
                float f;
                float ॱᐝ;
                float f2;
                int i2;
                if (ea.ˏ() != null) {
                    ei ˏ = ea.ˏ();
                    ˏ.ʽॱ++;
                }
                this.ˊ = this.ˋ.ˊ;
                this.ʽ.ˊ = this.ʽ.ˋ.ˊ;
                int i3 = (this.ˏ.ˏ == a.RIGHT || this.ˏ.ˏ == a.BOTTOM) ? 1 : 0;
                if (i3 != 0) {
                    f = this.ˋ.ʼ - this.ʽ.ˋ.ʼ;
                } else {
                    f = this.ʽ.ˋ.ʼ - this.ˋ.ʼ;
                }
                if (this.ˏ.ˏ == a.LEFT || this.ˏ.ˏ == a.RIGHT) {
                    ॱᐝ = f - ((float) this.ˏ.ˎ.ॱᐝ());
                    f = this.ˏ.ˎ.ॱʼ;
                } else {
                    ॱᐝ = f - ((float) this.ˏ.ˎ.ᐝॱ());
                    f = this.ˏ.ˎ.ᐝˋ;
                }
                int ˏ2 = this.ˏ.ˏ();
                int ˏ3 = this.ʽ.ˏ.ˏ();
                if (this.ˏ.ʻ() == this.ʽ.ˏ.ʻ()) {
                    f2 = 0.5f;
                    i2 = 0;
                } else {
                    i = ˏ2;
                    int i4 = ˏ3;
                    f2 = f;
                    i2 = i4;
                }
                ॱᐝ = (ॱᐝ - ((float) i)) - ((float) i2);
                if (i3 != 0) {
                    this.ʽ.ʼ = (((float) i2) + this.ʽ.ˋ.ʼ) + (ॱᐝ * f2);
                    this.ʼ = (this.ˋ.ʼ - ((float) i)) - (ॱᐝ * (1.0f - f2));
                } else {
                    this.ʼ = (((float) i) + this.ˋ.ʼ) + (ॱᐝ * f2);
                    this.ʽ.ʼ = (this.ʽ.ˋ.ʼ - ((float) i2)) - (ॱᐝ * (1.0f - f2));
                }
                ʻ();
                this.ʽ.ʻ();
            } else if (this.ʻ == 3 && this.ˋ != null && this.ˋ.ᐝ == 1 && this.ʽ != null && this.ʽ.ˋ != null && this.ʽ.ˋ.ᐝ == 1) {
                if (ea.ˏ() != null) {
                    ei ˏ4 = ea.ˏ();
                    ˏ4.ˈ++;
                }
                this.ˊ = this.ˋ.ˊ;
                this.ʽ.ˊ = this.ʽ.ˋ.ˊ;
                this.ʼ = this.ˋ.ʼ + this.ˎ;
                this.ʽ.ʼ = this.ʽ.ˋ.ʼ + this.ʽ.ˎ;
                ʻ();
                this.ʽ.ʻ();
            } else if (this.ʻ == 5) {
                this.ˏ.ˎ.ˏ();
            }
        }
    }

    public void ˊ(int i) {
        this.ʻ = i;
    }

    public void ॱ() {
        super.ॱ();
        this.ˋ = null;
        this.ˎ = 0.0f;
        this.ͺ = null;
        this.ॱˊ = 1;
        this.ˋॱ = null;
        this.ˏॱ = 1;
        this.ˊ = null;
        this.ʼ = 0.0f;
        this.ॱ = 0.0f;
        this.ʽ = null;
        this.ˊॱ = 0.0f;
        this.ʻ = 0;
    }

    public void ˎ() {
        eo ʻ = this.ˏ.ʻ();
        if (ʻ != null) {
            if (ʻ.ʻ() == this.ˏ) {
                this.ʻ = 4;
                ʻ.ˎ().ʻ = 4;
            }
            int ˏ = this.ˏ.ˏ();
            if (this.ˏ.ˏ == a.RIGHT || this.ˏ.ˏ == a.BOTTOM) {
                ˏ = -ˏ;
            }
            ˏ(ʻ.ˎ(), ˏ);
        }
    }

    public void ˏ(int i, ev evVar, int i2) {
        this.ʻ = i;
        this.ˋ = evVar;
        this.ˎ = (float) i2;
        this.ˋ.ॱ(this);
    }

    public void ˏ(ev evVar, int i) {
        this.ˋ = evVar;
        this.ˎ = (float) i;
        this.ˋ.ॱ(this);
    }

    public void ˎ(ev evVar, int i, ex exVar) {
        this.ˋ = evVar;
        this.ˋ.ॱ(this);
        this.ͺ = exVar;
        this.ॱˊ = i;
        this.ͺ.ॱ(this);
    }

    public void ˏ(ev evVar, float f) {
        this.ʽ = evVar;
        this.ˊॱ = f;
    }

    public void ˋ(ev evVar, int i, ex exVar) {
        this.ʽ = evVar;
        this.ˋॱ = exVar;
        this.ˏॱ = i;
    }

    void ˎ(ea eaVar) {
        eh ˋ = this.ˏ.ˋ();
        if (this.ˊ == null) {
            eaVar.ˋ(ˋ, (int) (this.ʼ + 0.5f));
        } else {
            eaVar.ˊ(ˋ, eaVar.ˊ(this.ˊ.ˏ), (int) (this.ʼ + 0.5f), 6);
        }
    }

    public float ˋ() {
        return this.ʼ;
    }
}
